import request from '@/utils/request-product'

//1.获取spu列表
//GET /admin/product/{page}/{limit}
export const reqSpulist=(page,limit,category3Id)=>{
    return request({url:`/admin/product/${page}/${limit}`,method:'get',params:{category3Id}
})
}

//2.通过id获取某个spu信息
//GET /admin/product/getSpuById/{spuId}
export const reqGetspu=(spuId)=>{
    return request({url:`/admin/product/getSpuById/${spuId}`,method:'get'
})
}

//3.品牌下拉框
//GET /admin/product/baseTrademark/getTrademarkList
export const reqGetTraddemark=()=>{
    return request({url:`/admin/product/baseTrademark/getTrademarkList`,method:'get'
})
}


//4.图片展示
//GET /admin/product/spuImageList/{spuId}
export const reqGetImage=(spuId)=>{
    return request({url:`/admin/product/spuImageList/${spuId}`,method:'get'
})
}


//5.3个销售属性
//GET /admin/product/baseSaleAttrList
export const reqbaseAttr=()=>{
    return request({url:`admin/product/baseSaleAttrList`,method:'get'
})
}

//6.添加和修改spu信息
//POST /admin/product/saveSpuInfo
//POST /admin/product/updateSpuInfo
export const reqAddandUpdatespu=(spuInfo)=>{
    if(spuInfo.id){
 return request({url:`/admin/product/updateSpuInfo`,method:'post',data:spuInfo})
    }else{
return request({url:`/admin/product/saveSpuInfo`,method:'post',data:spuInfo})
    }
}

//7.删除spu信息
// /DELETE /admin/product/deleteSpu/{spuId}
export const reqDeletespu=(spuId)=>{
    return request({url:`/admin/product/deleteSpu/${spuId}`,method:'delete'
})
}

//8.获取spuSaleAttrList列表
//GET /admin/product/spuSaleAttrList/{spuId}
export const reqspuSaleattrList=(spuId)=>{
    return request ({url:`/admin/product/spuSaleAttrList/${spuId}`,method:'get'})
}

//9.获取图片
//GET /admin/product/spuImageList/{spuId}
export const reqImageList=(spuId)=>{
    return request ({url:`/admin/product/spuImageList/${spuId}`,method:'get'})
}

//10.获取销售属性
//GET /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
export const reqattrInfoList=(category1Id,category2Id,category3Id)=>{
    return request ({url:`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,method:'get'})
}

//11.保存sku信息
//POST /admin/product/saveSkuInfo
export const reqSkuInfoList=(skuInfo)=>{
    return request ({url:`/admin/product/saveSkuInfo`,method:'post',data:skuInfo})
}
//12.查看sku信息
//GET /admin/product/findBySpuId/{spuId}
export const reqGetskuInfo=(spuId)=>{
    return request ({url:`/admin/product/findBySpuId/${spuId}`,method:'get'})
}